/*
 * @(#)EntityFunction.java        0.1 19-Apr-2009
 *
 * Copyright 2008 Thomas Ford. All rights reserved.
 */


package edu.napier.soc.xfdm.model;

/**
 * 
 * @version 0.1, 19-Apr-2009
 * @author  Thomas Ford
 */
public final class EntityFunction extends Function {

	private static final long serialVersionUID = 768544352495674l;

	private final EntityType entityType;

	public EntityFunction(String name, EntityType et, boolean isMultiValued) {
		super(name, ReturnType.ENTITY, isMultiValued);
		this.entityType = et;
	}

	@Override
	protected boolean isValidType(Object value) {
		if (!(value instanceof Entity)) {
			return false;
		}
		return ((Entity)value).getEntityType() == entityType;
	}

	public EntityType getEntityType() {
		return entityType;
	}
}
